package com.ServiceFeign.controller;

import com.ServiceFeign.service.ScheduledEurekaClient;
import com.ServiceFeign.service.ScheduledEurekaRibbon;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class FeignController {

    //编译器报错，无视。 因为这个Bean是在程序启动的时候注入的，编译器感知不到，所以报错。
    @Resource
    ScheduledEurekaClient scheduledEurekaClient;
    @Resource
    ScheduledEurekaRibbon scheduledEurekaRibbon;

    @GetMapping(value = "/toEurekaClient")
    public String toEurekaClient(@RequestParam(value = "name", defaultValue = "") String name) {
        System.out.println("to Feign！ toEurekaClient");
        return scheduledEurekaClient.sayHiFromClientOne( name );
    }

    @GetMapping(value = "/toEurekaRibbon")
    public String toEurekaRibbon(@RequestParam(value = "name", defaultValue = "") String name) {
        System.out.println("to Feign！toEurekaRibbon");
        return scheduledEurekaRibbon.sayHiFromClientOne( name );
    }

}
